package util;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 众e贷产品小红花与众益对应
 */
@Getter
@AllArgsConstructor
public enum ProductEnum {

    zed1("house", "众e贷1号", "P8762"),

    zed2("P0742", "众e贷2号", "P2010"),

    zed3("P2729", "众e贷3号", "P0933");

    private final String xhhCode; // 小红花产品编号
    private final String desc; // 产品名称
    private final String zyCode; // 众益产品编号

    public static ProductEnum getConditionOperateType(String xhhCode) {
        return Arrays.stream(ProductEnum.values())
                .filter(e -> e.getXhhCode().equals(xhhCode))
                .findFirst()
                .orElse(null);
    }

    public static Map<String, String> conditionOperateTypeMap = Arrays.stream(ProductEnum.values())
            .collect(Collectors.toMap(ProductEnum::getXhhCode,ProductEnum::getDesc));
}
